<template>
  <el-popover placement="top" width="300" v-model="visible">
    <el-container>
      <el-header>
        <h2>确认提交吗？</h2>
      </el-header>
      <el-main>
        <div>提交后该记录会被保存，且您将无法再次修改内容，请核对无误</div>
      </el-main>
      <el-footer>
        <el-button type="primary" @click="handleSubmit">确认提交</el-button>
        <el-button @click="handleCancel">取消</el-button>
      </el-footer>
    </el-container>
    <el-button slot="reference" type="primary" style="width:15em;max-width:50%;margin:0 1em">提交该记录</el-button>
  </el-popover>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
    };
  },
  methods: {
    handleSubmit() {
      this.$emit("submit");
      this.visible = false;
    },
    handleCancel() {
      this.visible = false;
    },
  },
};
</script>